class BaseSessionStorage {
    protected key: string

    constructor(key: string) {
        this.key = key
    }

    get = () => {
        const item = sessionStorage.getItem(this.key)
        if (item) {
            return JSON.parse(item)
        } else {
            return null
        }
    }

    set = (data: any) => {
        return sessionStorage.setItem(this.key, JSON.stringify(data))
    }

    remove = () => {
        return sessionStorage.removeItem(this.key)
    }
}

// 存储token
export const RouterRedirectStorage = new BaseSessionStorage('IS_REDIRECTING')
